package com.kuang.service;

import com.kuang.dao.UserDao;
import com.kuang.dao.UserDaoImpl;
import com.kuang.dao.UserDaoMysqlImpl;
import com.kuang.dao.UserOracleImpl;


public class UserServiceImpl implements UserDao {

    //法1:每次用户调用不同实现 都要深入此UserServiceImpl层改这行代码 （用户需求影响源代码）
    //private UserDao userDao = new UserDaoImpl();
    //private UserDao userDao = new UserDaoMysqlImpl();
    //private UserDao userDao = new UserOracleImpl();

    //法2: 利用set进行动态选择实现值的注入
    private UserDao userDao;
    public void setUserDao(UserDao userDao){
        this.userDao = userDao;
    }


    public void getUser(){
        userDao.getUser();
    }

}
